package day2;

public class Fruit {
    public static void main(String[] args) {
        Fruit fruit1 = new Apple();
        Fruit fruit2 = new Orange();
        //Fruit fruit3 = new Banana();  //报错  没有继承Fruit
        fruit1.f();
        fruit2.f();
    }
   public void f(){
       System.out.println("水果");
   }
}
class Apple extends Fruit{
    public void f(){
        System.out.println("苹果");
    }
}
class Orange extends Fruit{
    public  void f(){
        System.out.println("橘子");
    }
}
class Banana{

}